# Contributor:
# Maintainer:
pkgname=guacamole-server
pkgver=1.4.0
pkgrel=0
pkgdesc="clientless remote desktop gateway server"
url="https://guacamole.apache.org"
arch="all"
license="GPL-3.0-or-later"
makedepends="cairo-dev libjpeg-turbo-dev libpng-dev ossp-uuid-dev ffmpeg4-dev
	freerdp-dev pango-dev libssh2-dev libvncserver-dev pulseaudio-dev
	openssl-dev libvorbis-dev libwebp-dev perl libwebsockets-dev cunit-dev
	"
subpackages="$pkgname-doc $pkgname-dev"
source="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/$pkgver/source/guacamole-server-$pkgver.tar.gz
	"

build() {
	# Disables erroring out on functions that are deprecated
	# like 'av_init_packet' and 'VerifyCertificate'
	CFLAGS="$CFLAGS -Wno-error=deprecated-declarations" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-static \
		--with-libavcodec \
		--with-libavutil \
		--with-libswscale \
		--with-ssl \
		--without-winsock \
		--with-vorbis \
		--with-pulse \
		--with-pango \
		--with-terminal \
		--with-vnc \
		--with-rdp \
		--with-ssh \
		--without-telnet \
		--with-webp \
		--with-websockets
	make
}

check() {
	# 4 Tests fail on s390x
	# test_common 10
	# test_common 12
	# test_common 13
	# test_common 14
	[ "$CARCH" = s390x ] && return 0
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}
sha512sums="
5a59430d6ca9e8808442067282e5d87b8da3c6a8fc92e6120c70044dce3a18beb9ec3c9f34ef14580ceeaac5fd00fd3f27e8cd60bd6c4e380f3bcca5e7f25632  guacamole-server-1.4.0.tar.gz
"
